<template>
    <el-card>
        <el-row :gutter="5">
            <el-col :md="{span:8}" :sm="{span: 12}">
                <el-input
                        v-model="search.content"
                        placeholder="请输入用户名或者id"
                        class="search-doctor-input"
                >
                    <template #append>
                        <el-button style="width: 100px" @click="LoadPrescriptionDatas(1)">
                            <el-icon>
                                <i class="fas fa-search" />
                            </el-icon>
                            搜索
                        </el-button>
                    </template>
                </el-input>
            </el-col>
        </el-row>
    </el-card>
    <el-card style="margin-top: 10px">

        <el-table :data="prescriptionDatas" style="width: 100%">
            <el-table-column prop="prescriptionId" label="诊断ID" />
            <el-table-column prop="userName" label="出诊医生"  />
            <el-table-column prop="patientName" label="患者名字"  />
            <el-table-column prop="patientIdnum" label="患者身份证"  />
            <el-table-column prop="prescriptionDiagnosis" label="处方内容"  />
            <el-table-column prop="drugs" label="处方用药"  />
        </el-table>
    </el-card>
    <el-card style="margin-top: 10px">
        <el-pagination style="text-align: center" layout="prev, pager, next" :page-size="pageInation.pageSize" :page-count="pageInation.pageCount" @current-change="LoadWarehouseDatas" small></el-pagination>
    </el-card>
</template>

<script>
    import utils from "@/Utils";

    export default {
        name: "SystemAdminPrescription",
        data(){
            return{
                search:{
                    content:''
                },
                prescriptionDatas:[],
                pageInation:{
                    pageCount:0,
                    pageSize:0,
                },
                loading:true,
                dialog:{
                    isShowAddUser:false
                },
                utils
            }
        },
        methods:{
            LoadPrescriptionDatas:async function (pageIndex) {
                this.loading=true;
                const search=this.search.content;
                console.log(search)
                await this.axios.post("/Prescription/isLogin/getPrescriptions",{
                    pageIndex:pageIndex,
                    pageSize:10,
                    search:search
                }).then((req)=>{
                    const data=req.data;
                    if(data.code>0){
                        this.utils.tipsMessage(data.error,data.code);
                        return
                    }
                    const pageData=data.data.pageData;
                    this.pageInation.pageSize=data.data.pageSize;
                    this.pageInation.pageCount=data.data.pageCount;
                    this.prescriptionDatas=pageData;
                    this.loading=false
                })
            },
        },
        mounted(){
            this.LoadPrescriptionDatas(1);
        }
    }
</script>

<style scoped>
    .search-doctor-input /deep/ .el-input-group__prepend,.search-doctor-input /deep/ .el-input-group__append {
        background-color: #fff;
    }
</style>